home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_02
/
1102106a
< prev
next >
Wrap
Text File
|
1992-12-02
|
884b
|
63 lines
int select_entering(void)
{
int i,j;
enter_pos = 0;
enter_holder = 0.0;
/* determine the most neg value, if any */
for (j=1; j<COLUMNS-1; j++) {
if (table[0][j]<0) {
if (table[0][j] < enter_holder) {
enter_holder = table[0][j];
enter_pos = j;
}
}
}
/* if j has been changed from 0, then we have
an entering equation */
return(enter_pos);
}
int select_leaving(void)
{
int i,j;
float ratio[50];
leave_pos = 0;
leave_holder = 999.0;
/* determine the lowest ratio of the
positive elements */
for (i=1; i<ROWS;i++) {
if (table[i][enter_pos] > 0) {
ratio[i] =
table[i][COLUMNS-1]/table[i][enter_pos];
if (ratio[i] < leave_holder) {
leave_holder = ratio[i];
leave_pos = i;
}
}
}
return (leave_pos);
}